import {createRouter,createWebHashHistory} from 'vue-router'

const routes = [
    {
        path:'/',
        component: () => import('../views/Main.vue'),
        redirect:'/home',
        children:[
            {
                path:'home',
                name:'Home',
                component: () => import('../views/Home.vue'),
                meta:{isAuth:false}
            },
            {
                path:'blog',
                name:'Blog',
                component: () => import('../views/Blog.vue'),
                meta:{isAuth:false}
            },
            {
                path:'blog-search',
                name:'BlogSearch',
                component: () => import('../views/BlogSearchList.vue'),
                meta:{isAuth:false}
            },
            {
                path:'article/detail/:articleId',
                name:'ArticleDetail',
                component: () => import('../views/ArticleDetail.vue'),
                meta:{isAuth:false}
            },
            {
                path:'post',
                name:'Post',
                component: () => import('../views/Post.vue'),
                meta:{isAuth:false}
            },
            {
                path:'post-list/:columnId',
                name:'PostList',
                component: () => import('../views/PostList.vue'),
                meta:{isAuth:false}
            },
            {
                path:'post/detail/:postId',
                name:'PostDetail',
                component: () => import('../views/PostDetail.vue'),
                meta:{isAuth:false}
            },
            {
                path:'resource',
                name:'Resource',
                component: () => import('../views/Resource.vue'),
                meta:{isAuth:false}
            },
            {
                path:'user/detail/:userId',
                name:'UserDetail',
                component: () => import('../views/UserDetail.vue'),
                meta:{isAuth:true}
            },
            {
                path:'content/manage/:userId',
                name:'ContentManage',
                component: () => import('../views/ContentManage.vue'),
                meta:{isAuth:true}
            },
            {
                path:'history/:userId',
                name:'History',
                component: () => import('../views/History.vue'),
                meta:{isAuth:true}
            },
        ]
    },
    {
        path:'/login',
        name:'Login',
        component: () => import('../views/Login.vue'),
        meta:{isAuth:false}
    },
    {
        path:'/signup',
        name:'Signup',
        component: () => import('../views/Signup.vue'),
        meta:{isAuth:false}
    },
    {
        path:'/publish/:type',
        name:'Publish',
        component: () => import('../views/Publish.vue'),
        meta:{isAuth:true}
    },

]

const router = createRouter({
    history:createWebHashHistory(),
    routes
})

export default router
